#ifndef LOCKABLECONTAINER_H
#define LOCKABLECONTAINER_H
#include "RoomInventory.h"
#include "Door.h"

class LockableContainer: public Door, public RoomInventory
{
    public:

        LockableContainer()
        {
            setObjectType("LockableContainer");
        }

        LockableContainer(string desc, string keyID):Door(keyID)
        {
            setObjectType("LockableContainer");
            setDesc(desc);
        }

        vector<Listing>const*  getManifest()
        {
            if(!isLocked())
            {
                return &manifest;
            }
            else {return NULL;}
        }
        void saveLockableContainer(ostream& out)
        {
            out << getDesc() << ',' << keyID << ',';
            if(locked) out << '1';
            else out << '0';
            out << endl;
            RoomInventory::saveRoomInventory(out);
        }
        void loadLockableContainer(istream& in)
        {
            char *tk = NULL;// pointers to chars
            char data[MAX] = ""; //to hold line
            in.getline(data,MAX - 1, '\n');
            tk = strtok(data, DELIMS); // get next token
            setDesc(tk);
            tk = strtok(NULL, DELIMS); // get next token
            keyID = tk;
            tk = strtok(NULL, DELIMS); // get next token
            locked = atoi(tk);
            RoomInventory::loadRoomInventory(in);
        }
    protected:
    private:
};

#endif // LOCKABLECONTAINER_H
